// 表单校验规则
export const phone = [
  {
    required: true,
   errorMessage: '请输入手机号码',
  }, {
	  pattern: /^(?:(?:\+|00)86)?1[3-9]\d{9}$/,
	  errorMessage: '请输入正确手机号码',
  },

];
export const name = [
  { required: true, errorMessage: '请输入姓名', trigger: ['change', 'blur'] },
  { min: 2, max: 16, errorMessage: '名字在2 - 16个字符之间', trigger: ['change', 'blur'] },
];
// 密码
export const password = [
  {
    required: true,
    pattern: /^\S*(?=\S{6,})(?=\S*\d)(?=\S*[A-Z])(?=\S*[a-z])(?=\S*[!@#$%^&*? ])\S*$/,
    errorMessage: '最少6位(大小写字母 数字 特殊字符)各1个',
    trigger: ['change', 'blur'],
  },
];

// 登录名
export const loginName = [
  { required: true, errorMessage: '请输入登录名', trigger: ['change', 'blur'] },
  { min: 2, max: 16, errorMessage: '登录名在2 - 16个字符之间', trigger: ['change', 'blur'] },
];
// 邮箱
export const email = [
  { type: 'email', errorMessage: '请输入正确的邮箱地址', trigger: ['change', 'blur'] },
];
// 身份证
export const identity = [
  {
    required: true,
    errorMessage: '请输入身份证号',
  },
  {
	  pattern: /^[1-9]\d{5}(?:18|19|20)\d{2}(?:0[1-9]|10|11|12)(?:0[1-9]|[1-2]\d|30|31)\d{3}[\dXx]$/,
	  errorMessage: '请输入正确身份证号',
  },
];
// 单一通用校验
export const ruleRequired = (message) => {
  return { required: true, errorMessage: message };
};
// 验证码
export const code = [
  { required: true, pattern: /\d{4}/, errorMessage: '请输入正确的验证码', trigger: ['change', 'blur'] },
];
